#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>

struct Employee 
{
    char name[11];
    float base_salary;
    float bonus;
    float expense;
};

int main() 
{
    int n;   
    scanf("%d", &n);
    struct Employee employees[100];
    for (int i = 0; i < n; i++) 
    {
        scanf("%s %f %f %f", employees[i].name, &employees[i].base_salary, &employees[i].bonus ,&employees[i].expense);
    }
    for (int i = 0; i < n; i++) 
    {
        printf("%s %.2f\n", employees[i].name, employees[i].base_salary + employees[i].bonus - employees[i].expense);
    }
    return 0;
}